<?php

class Controller_Services extends Controller_Website
{
    public function before() {
        parent::before();
        $this->section = 'services';
        $this->template->activeCat = 'services';
    }

    public function actionIndex()
    {
        $this->template->title = $this->settings['title'];
        $this->template->content = new View('services/index');
        $this->addScript('/scripts/jquery/jquery.tools.min.js');
        //fancybox
        $this->addScript('/scripts/fancybox/jquery.fancybox.pack.js');
        $this->addStyle('/styles/fancybox/jquery.fancybox.css');

        //services form
        $this->addScript('/scripts/servicesform.js');

        //jscrollpane
        $this->addScript('/scripts/jscrollpane/jquery.mousewheel.js');
        $this->addScript('/scripts/jscrollpane/mwheelIntent.js');
        $this->addScript('/scripts/jscrollpane/jquery.jscrollpane.min.js');
        $this->addStyle('/styles/jquery.jscrollpane_new.css');


        //get texts
            //home
        $homeCat = $this->direc->getCategoryByToken('32v',$this->section);
        $homeBlocks = $this->direc->getCategoryItems($homeCat['id'], $this->section, $order = 'position', $orderDir = 'ASC');

        $homeTopText = $this->direc->getItemByToken('06l', $this->section);
        $this->template->content->homeTopText = $homeTopText;

        $this->template->content->homeBlocks = $homeBlocks;
            //commercial
        $commercCat = $this->direc->getCategoryByToken('fj1',$this->section);
        $commercBlocks = $this->direc->getCategoryItems($commercCat['id'], $this->section, $order = 'position', $orderDir = 'ASC');

        $commTopText = $this->direc->getItemByToken('9nc', $this->section);
        $this->template->content->commTopText = $commTopText;

        $this->template->content->commercBlocks = $commercBlocks;


        //////////////////////////////////HOME FORMS //////////////////////////////////////////////////////////////
        //first form
        $form_1_name = 'one_time_cleaning';



        $form = new Form($form_1_name,'','');
        $form->hidden('residence_type','home');

        $form->fieldset('main_services_info');
        $form->radio('how_many_bedrooms',array('studio'=>Model_Abstract::STUDIO,'one_bedroom'=>Model_Abstract::ONE_BEDROOM,'two_bedrooms'=>Model_Abstract::TWO_BEDROOMS,'three_bedrooms'=>Model_Abstract::THREE_BEDROOMS,'four_bedrooms'=>Model_Abstract::FOUR_BEDROOMS,'more_bedrooms'=>Model_Abstract::MORE_BEDROOMS),Model_Abstract::BEDROOMS)->rule('required');
        $form->radio('how_many_bathrooms',array('one_bathroom'=>Model_Abstract::ONE_BATHROOM,'one_andhalf_bathroom'=>Model_Abstract::ONE_AND_HALF_BATHROOM,'two_bathrooms'=>Model_Abstract::TWO_BATHROOMS,'three_bathrooms'=>Model_Abstract::THREE_BATHROOMS,'more_bathrooms'=>Model_Abstract::MORE_BATHROOMS),Model_Abstract::BATHROOMS)->rule('required');



        $form->fieldset('main_services_details');
        $form->textarea('best_days',Model_Abstract::BESTDAYS)->rule('required');
        $form->textarea('request_details',Model_Abstract::DETAILS)->rule('required');

        $form->fieldset('main_services_names');

        $form->text('name',Model_Abstract::FIRST_NAME)->rule('required')->rule('alphanumcyr')->setWrapperClass('float50');
        $form->text('last_name',Model_Abstract::LAST_NAME)->rule('required')->rule('alphanumcyr')->setWrapperClass('float47');
        $form->text('email',Model_Abstract::EMAIL)->rule('required')->rule('email')->setWrapperClass('float50');

        $form->text('phon_num',Model_Abstract::PHONE_NUM)->rule('required')->setWrapperClass('float47');
        $form->text('zip_code',Model_Abstract::ZIP_CODE)->rule('required')->rule('alphanum')->setWrapperClass('float50');
        $form->text('address',Model_Abstract::ADDRESS)->rule('required')->setWrapperClass('float47');
        $form->submit('submit','')->setWrapperClass('floatL');

        $form->fieldset('submit');




        $this->template->content->form = $form;



        if (Request::$method == 'POST') {

            if ($form->validate()) {
                if(isset($_SESSION['form_error'])){
                    unset($_SESSION['form_error']);
                }

                $values = $form->getValues();

                $this->services = new Model_Services($values,$form_1_name);
                $reqId = $this->services->addRequest();
                $this->services->sendRequestOnEmail($reqId);

                if($reqId){
                    echo '<script type="text/javascript">alert("Thank you choosing us!\\nOur manager will work up your request and contact you soon")</script>';
                }
            }
            elseif(!$form->validate()) {
                if(!isset($_SESSION)){
                    session_start();
                }
                $_SESSION['form_error'] = true;
            }
        }


        //second form

        $form_2_name = 'recurring_cleaning';
        $form2 = new Form($form_2_name,'','');
        $form2->hidden('residence_type','home');

        $form2->fieldset('main_services_info');

        $form2->radio('how_often',array('weekly'=>Model_Abstract::WEEKLY,'monthly'=>Model_Abstract::MONTHLY,'every_other_week'=>Model_Abstract::EVERY_OTHER_WEEK,'not_sure_yet'=>Model_Abstract::NOT_SURE_YET,),Model_Abstract::OFTEN)->rule('required');
        $form2->radio('how_many_bedrooms',array('studio'=>Model_Abstract::STUDIO,'one_bedroom'=>Model_Abstract::ONE_BEDROOM,'two_bedrooms'=>Model_Abstract::TWO_BEDROOMS,'three_bedrooms'=>Model_Abstract::THREE_BEDROOMS,'four_bedrooms'=>Model_Abstract::FOUR_BEDROOMS,'more_bedrooms'=>Model_Abstract::MORE_BEDROOMS),Model_Abstract::BEDROOMS)->rule('required');
        $form2->radio('how_many_bathrooms',array('one_bathroom'=>Model_Abstract::ONE_BATHROOM,'one_andhalf_bathroom'=>Model_Abstract::ONE_AND_HALF_BATHROOM,'two_bathrooms'=>Model_Abstract::TWO_BATHROOMS,'three_bathrooms'=>Model_Abstract::THREE_BATHROOMS,'more_bathrooms'=>Model_Abstract::MORE_BATHROOMS),Model_Abstract::BATHROOMS)->rule('required');



        $form2->fieldset('main_services_details');
        $form2->textarea('best_days',Model_Abstract::BESTDAYS)->rule('required');
        $form2->textarea('request_details',Model_Abstract::DETAILS)->rule('required');

        $form2->fieldset('main_services_names');

        $form2->text('name',Model_Abstract::FIRST_NAME)->rule('required')->rule('alphanumcyr')->setWrapperClass('float50');
        $form2->text('last_name',Model_Abstract::LAST_NAME)->rule('required')->rule('alphanumcyr')->setWrapperClass('float47');
        $form2->text('email',Model_Abstract::EMAIL)->rule('required')->rule('email')->setWrapperClass('float50');

        $form2->text('phon_num',Model_Abstract::PHONE_NUM)->rule('required')->setWrapperClass('float47');
        $form2->text('zip_code',Model_Abstract::ZIP_CODE)->rule('required')->rule('alphanum')->setWrapperClass('float50');
        $form2->text('address',Model_Abstract::ADDRESS)->rule('required')->setWrapperClass('float47');

        $form2->submit('submit','')->setWrapperClass('floatL');

//        $form2->fieldset('submit');


        $this->template->content->form2 = $form2;

        if (Request::$method == 'POST') {

            if ($form2->validate()) {
                if(isset($_SESSION['form_error'])){
                    unset($_SESSION['form_error']);
                }

                $values = $form2->getValues();

                $this->services = new Model_Services($values,$form_2_name);
                $reqId = $this->services->addRequest();
                $this->services->sendRequestOnEmail($reqId);

                if($reqId){
                    echo '<script type="text/javascript">alert("Thank you choosing us!\\nOur manager will work up your request and contact you soon")</script>';
                }

            }
            elseif(!$form2->validate()) {
                if(!isset($_SESSION)){
                    session_start();
                }
                $_SESSION['form_error'] = true;
            }
        }

        //third form

        $form_3_name = 'general_cleaning';
        $form3 = new Form($form_3_name,'','');
        $form3->hidden('residence_type','home');

        $form3->fieldset('main_services_info');

        $form3->radio('how_often',array('weekly'=>Model_Abstract::WEEKLY,'monthly'=>Model_Abstract::MONTHLY,'every_other_week'=>Model_Abstract::EVERY_OTHER_WEEK,'not_sure_yet'=>Model_Abstract::NOT_SURE_YET,),Model_Abstract::OFTEN)->rule('required');
        $form3->radio('how_many_bedrooms',array('studio'=>Model_Abstract::STUDIO,'one_bedroom'=>Model_Abstract::ONE_BEDROOM,'two_bedrooms'=>Model_Abstract::TWO_BEDROOMS,'three_bedrooms'=>Model_Abstract::THREE_BEDROOMS,'four_bedrooms'=>Model_Abstract::FOUR_BEDROOMS,'more_bedrooms'=>Model_Abstract::MORE_BEDROOMS),Model_Abstract::BEDROOMS)->rule('required');
        $form3->radio('how_many_bathrooms',array('one_bathroom'=>Model_Abstract::ONE_BATHROOM,'one_andhalf_bathroom'=>Model_Abstract::ONE_AND_HALF_BATHROOM,'two_bathrooms'=>Model_Abstract::TWO_BATHROOMS,'three_bathrooms'=>Model_Abstract::THREE_BATHROOMS,'more_bathrooms'=>Model_Abstract::MORE_BATHROOMS),Model_Abstract::BATHROOMS)->rule('required');



        $form3->fieldset('main_services_details');
        $form3->textarea('best_days',Model_Abstract::BESTDAYS)->rule('required');
        $form3->textarea('request_details',Model_Abstract::DETAILS)->rule('required');

        $form3->fieldset('main_services_names');

        $form3->text('name',Model_Abstract::FIRST_NAME)->rule('required')->rule('alphanumcyr')->setWrapperClass('float50');
        $form3->text('last_name',Model_Abstract::LAST_NAME)->rule('required')->rule('alphanumcyr')->setWrapperClass('float47');
        $form3->text('email',Model_Abstract::EMAIL)->rule('required')->rule('email')->setWrapperClass('float50');

        $form3->text('phon_num',Model_Abstract::PHONE_NUM)->rule('required')->setWrapperClass('float47');
        $form3->text('zip_code',Model_Abstract::ZIP_CODE)->rule('required')->rule('alphanum')->setWrapperClass('float50');
        $form3->text('address',Model_Abstract::ADDRESS)->rule('required')->setWrapperClass('float47');

        $form3->submit('submit','')->setWrapperClass('floatL');

        $this->template->content->form3 = $form3;

        if (Request::$method == 'POST') {

            if ($form3->validate()) {
                if(isset($_SESSION['form_error'])){
                    unset($_SESSION['form_error']);
                }

                $values = $form3->getValues();

                $this->services = new Model_Services($values,$form_3_name);
                $reqId = $this->services->addRequest();
                $this->services->sendRequestOnEmail($reqId);

                if($reqId){
                    echo '<script type="text/javascript">alert("Thank you choosing us!\\nOur manager will work up your request and contact you soon")</script>';
                }

            }
            elseif(!$form3->validate()) {
                if(!isset($_SESSION)){
                    session_start();
                }
                $_SESSION['form_error'] = true;
            }
        }


        //fourth form

        $form_4_name = 'moving_cleaning';
        $form4 = new Form($form_4_name,'','');
        $form4->hidden('residence_type','home');

        $form4->fieldset('main_services_info');
        $form4->radio('how_many_bedrooms',array('studio'=>Model_Abstract::STUDIO,'one_bedroom'=>Model_Abstract::ONE_BEDROOM,'two_bedrooms'=>Model_Abstract::TWO_BEDROOMS,'three_bedrooms'=>Model_Abstract::THREE_BEDROOMS,'four_bedrooms'=>Model_Abstract::FOUR_BEDROOMS,'more_bedrooms'=>Model_Abstract::MORE_BEDROOMS),Model_Abstract::BEDROOMS)->rule('required');
        $form4->radio('how_many_bathrooms',array('one_bathroom'=>Model_Abstract::ONE_BATHROOM,'one_andhalf_bathroom'=>Model_Abstract::ONE_AND_HALF_BATHROOM,'two_bathrooms'=>Model_Abstract::TWO_BATHROOMS,'three_bathrooms'=>Model_Abstract::THREE_BATHROOMS,'more_bathrooms'=>Model_Abstract::MORE_BATHROOMS),Model_Abstract::BATHROOMS)->rule('required');

        $form4->fieldset('main_services_details');
        $form4->textarea('best_days',Model_Abstract::BESTDAYS)->rule('required');
        $form4->textarea('request_details',Model_Abstract::DETAILS)->rule('required');

        $form4->fieldset('main_services_names');

        $form4->text('name',Model_Abstract::FIRST_NAME)->rule('required')->rule('alphanumcyr')->setWrapperClass('float50');
        $form4->text('last_name',Model_Abstract::LAST_NAME)->rule('required')->rule('alphanumcyr')->setWrapperClass('float47');
        $form4->text('email',Model_Abstract::EMAIL)->rule('required')->rule('email')->setWrapperClass('float50');

        $form4->text('phon_num',Model_Abstract::PHONE_NUM)->rule('required')->setWrapperClass('float47');
        $form4->text('zip_code',Model_Abstract::ZIP_CODE)->rule('required')->rule('alphanum')->setWrapperClass('float50');
        $form4->text('address',Model_Abstract::ADDRESS)->rule('required')->setWrapperClass('float47');

        $form4->submit('submit','')->setWrapperClass('floatL');

        $this->template->content->form4 = $form4;

        if (Request::$method == 'POST') {

            if ($form4->validate()) {
                if(isset($_SESSION['form_error'])){
                    unset($_SESSION['form_error']);
                }

                $values = $form4->getValues();

                $this->services = new Model_Services($values,$form_4_name);
                $reqId = $this->services->addRequest();
                $this->services->sendRequestOnEmail($reqId);

                if($reqId){
                    echo '<script type="text/javascript">alert("Thank you choosing us!\\nOur manager will work up your request and contact you soon")</script>';
                }

            }
            elseif(!$form4->validate()) {
                if(!isset($_SESSION)){
                    session_start();
                }
                $_SESSION['form_error'] = true;
            }
        }


        //fifth form

        $form_5_name = 'post_cleaning';
        $form5 = new Form($form_5_name,'','');

        $form5->hidden('residence_type','home');

        $form5->fieldset('main_services_info');
        $form5->radio('how_many_bedrooms',array('studio'=>Model_Abstract::STUDIO,'one_bedroom'=>Model_Abstract::ONE_BEDROOM,'two_bedrooms'=>Model_Abstract::TWO_BEDROOMS,'three_bedrooms'=>Model_Abstract::THREE_BEDROOMS,'four_bedrooms'=>Model_Abstract::FOUR_BEDROOMS,'more_bedrooms'=>Model_Abstract::MORE_BEDROOMS),Model_Abstract::BEDROOMS)->rule('required');
        $form5->radio('how_many_bathrooms',array('one_bathroom'=>Model_Abstract::ONE_BATHROOM,'one_andhalf_bathroom'=>Model_Abstract::ONE_AND_HALF_BATHROOM,'two_bathrooms'=>Model_Abstract::TWO_BATHROOMS,'three_bathrooms'=>Model_Abstract::THREE_BATHROOMS,'more_bathrooms'=>Model_Abstract::MORE_BATHROOMS),Model_Abstract::BATHROOMS)->rule('required');

        $form5->fieldset('main_services_details');
        $form5->textarea('best_days',Model_Abstract::BESTDAYS)->rule('required');
        $form5->textarea('request_details',Model_Abstract::DETAILS)->rule('required');

        $form5->fieldset('main_services_names');

        $form5->text('name',Model_Abstract::FIRST_NAME)->rule('required')->rule('alphanumcyr')->setWrapperClass('float50');
        $form5->text('last_name',Model_Abstract::LAST_NAME)->rule('required')->rule('alphanumcyr')->setWrapperClass('float47');
        $form5->text('email',Model_Abstract::EMAIL)->rule('required')->rule('email')->setWrapperClass('float50');

        $form5->text('phon_num',Model_Abstract::PHONE_NUM)->rule('required')->setWrapperClass('float47');
        $form5->text('zip_code',Model_Abstract::ZIP_CODE)->rule('required')->rule('alphanum')->setWrapperClass('float50');
        $form5->text('address',Model_Abstract::ADDRESS)->rule('required')->setWrapperClass('float47');

        $form5->submit('submit','')->setWrapperClass('floatL');

        $this->template->content->form5 = $form5;

        if (Request::$method == 'POST') {

            if ($form5->validate()) {
                if(isset($_SESSION['form_error'])){
                    unset($_SESSION['form_error']);
                }

                $values = $form5->getValues();

                $this->services = new Model_Services($values,$form_5_name);
                $reqId = $this->services->addRequest();
                $this->services->sendRequestOnEmail($reqId);

                if($reqId){
                    echo '<script type="text/javascript">alert("Thank you choosing us!\\nOur manager will work up your request and contact you soon")</script>';
                }

            }
            elseif(!$form5->validate()) {
                if(!isset($_SESSION)){
                    session_start();
                }
                $_SESSION['form_error'] = true;
            }
        }



        //sixth form

        $form_6_name = 'seasonal_cleaning';
        $form6 = new Form($form_6_name,'','');

        $form6->hidden('residence_type','home');

        $form6->fieldset('main_services_info');
        $form6->radio('how_many_bedrooms',array('studio'=>Model_Abstract::STUDIO,'one_bedroom'=>Model_Abstract::ONE_BEDROOM,'two_bedrooms'=>Model_Abstract::TWO_BEDROOMS,'three_bedrooms'=>Model_Abstract::THREE_BEDROOMS,'four_bedrooms'=>Model_Abstract::FOUR_BEDROOMS,'more_bedrooms'=>Model_Abstract::MORE_BEDROOMS),Model_Abstract::BEDROOMS)->rule('required');
        $form6->radio('how_many_bathrooms',array('one_bathroom'=>Model_Abstract::ONE_BATHROOM,'one_andhalf_bathroom'=>Model_Abstract::ONE_AND_HALF_BATHROOM,'two_bathrooms'=>Model_Abstract::TWO_BATHROOMS,'three_bathrooms'=>Model_Abstract::THREE_BATHROOMS,'more_bathrooms'=>Model_Abstract::MORE_BATHROOMS),Model_Abstract::BATHROOMS)->rule('required');

        $form6->fieldset('main_services_details');
        $form6->textarea('best_days',Model_Abstract::BESTDAYS)->rule('required');
        $form6->textarea('request_details',Model_Abstract::DETAILS)->rule('required');

        $form6->fieldset('main_services_names');

        $form6->text('name',Model_Abstract::FIRST_NAME)->rule('required')->rule('alphanumcyr')->setWrapperClass('float50');
        $form6->text('last_name',Model_Abstract::LAST_NAME)->rule('required')->rule('alphanumcyr')->setWrapperClass('float47');
        $form6->text('email',Model_Abstract::EMAIL)->rule('required')->rule('email')->setWrapperClass('float50');

        $form6->text('phon_num',Model_Abstract::PHONE_NUM)->rule('required')->setWrapperClass('float47');
        $form6->text('zip_code',Model_Abstract::ZIP_CODE)->rule('required')->rule('alphanum')->setWrapperClass('float50');
        $form6->text('address',Model_Abstract::ADDRESS)->rule('required')->setWrapperClass('float47');

        $form6->submit('submit','')->setWrapperClass('floatL');


        $this->template->content->form6 = $form6;

        if (Request::$method == 'POST') {

            if ($form6->validate()) {
                if(isset($_SESSION['form_error'])){
                    unset($_SESSION['form_error']);
                }

                $values = $form6->getValues();

                $this->services = new Model_Services($values,$form_6_name);
                $reqId = $this->services->addRequest();
                $this->services->sendRequestOnEmail($reqId);

                if($reqId){
                    echo '<script type="text/javascript">alert("Thank you choosing us!\\nOur manager will work up your request and contact you soon")</script>';
                }

            }
            elseif(!$form6->validate()) {
                if(!isset($_SESSION)){
                    session_start();
                }
                $_SESSION['form_error'] = true;
            }
        }

        //seventh form

        $form_7_name = 'after_party_cleaning';
        $form7 = new Form($form_7_name,'','');
        $form7->hidden('residence_type','home');

        $form7->fieldset('main_services_info');
        $form7->radio('how_many_bedrooms',array('studio'=>Model_Abstract::STUDIO,'one_bedroom'=>Model_Abstract::ONE_BEDROOM,'two_bedrooms'=>Model_Abstract::TWO_BEDROOMS,'three_bedrooms'=>Model_Abstract::THREE_BEDROOMS,'four_bedrooms'=>Model_Abstract::FOUR_BEDROOMS,'more_bedrooms'=>Model_Abstract::MORE_BEDROOMS),Model_Abstract::BEDROOMS)->rule('required');
        $form7->radio('how_many_bathrooms',array('one_bathroom'=>Model_Abstract::ONE_BATHROOM,'one_andhalf_bathroom'=>Model_Abstract::ONE_AND_HALF_BATHROOM,'two_bathrooms'=>Model_Abstract::TWO_BATHROOMS,'three_bathrooms'=>Model_Abstract::THREE_BATHROOMS,'more_bathrooms'=>Model_Abstract::MORE_BATHROOMS),Model_Abstract::BATHROOMS)->rule('required');



        $form7->fieldset('main_services_details');
        $form7->textarea('best_days',Model_Abstract::BESTDAYS)->rule('required');
        $form7->textarea('request_details',Model_Abstract::DETAILS)->rule('required');

        $form7->fieldset('main_services_names');

        $form7->text('name',Model_Abstract::FIRST_NAME)->rule('required')->rule('alphanumcyr')->setWrapperClass('float50');
        $form7->text('last_name',Model_Abstract::LAST_NAME)->rule('required')->rule('alphanumcyr')->setWrapperClass('float47');
        $form7->text('email',Model_Abstract::EMAIL)->rule('required')->rule('email')->setWrapperClass('float50');

        $form7->text('phon_num',Model_Abstract::PHONE_NUM)->rule('required')->setWrapperClass('float47');
        $form7->text('zip_code',Model_Abstract::ZIP_CODE)->rule('required')->rule('alphanum')->setWrapperClass('float50');
        $form7->text('address',Model_Abstract::ADDRESS)->rule('required')->setWrapperClass('float47');

        $form7->submit('submit','')->setWrapperClass('floatL');


        $this->template->content->form7 = $form7;

        if (Request::$method == 'POST') {

            if ($form7->validate()) {
                if(isset($_SESSION['form_error'])){
                    unset($_SESSION['form_error']);
                }

                $values = $form7->getValues();

                $this->services = new Model_Services($values,$form_7_name);
                $reqId = $this->services->addRequest();
                $this->services->sendRequestOnEmail($reqId);

                if($reqId){
                    echo '<script type="text/javascript">alert("Thank you choosing us!\\nOur manager will work up your request and contact you soon")</script>';
                }

            }
            elseif(!$form7->validate()) {
                if(!isset($_SESSION)){
                    session_start();
                }
                $_SESSION['form_error'] = true;
            }
        }
//////////////////////////////////COMMERCIAL FORMS //////////////////////////////////////////////////////////////
        //1 commercial form(8)

        $form_8_name = 'one_time_cleaning_comm';
        $form8 = new Form($form_8_name,'','');
        $form8->hidden('residence_type','Commercial');

        $form8->fieldset('main_services_info');

        $form8->text('business_type',Model_Abstract::BUSINESS_TYPE)->rule('required')->setWrapperClass('float50');
        $form8->text('how_many_rooms',Model_Abstract::ROOMS)->rule('required')->rule('integer')->setWrapperClass('float47');

        $form8->text('how_many_bathrooms',Model_Abstract::BATHROOMS)->rule('required')->rule('integer')->setWrapperClass('float50');
        $form8->text('square',Model_Abstract::SQUARE)->rule('float')->setWrapperClass('float47');

        $form8->radio('how_many_levels',array('one_level'=>Model_Abstract::ONE_LEVEL,'two_levels'=>Model_Abstract::TWO_LEVELS,'three_levels'=>Model_Abstract::THREE_LEVELS,'four_levels'=>Model_Abstract::FOUR_LEVELS,'more_levels'=>Model_Abstract::MORE_LEVELS),Model_Abstract::LEVELS)->setWrapperClass('floatL100');

        $form8->fieldset('main_services_more');


        $form8->fieldset('main_services_details');
        $form8->textarea('best_days',Model_Abstract::BESTDAYS)->rule('required');
        $form8->textarea('request_details',Model_Abstract::DETAILS)->rule('required');

        $form8->fieldset('main_services_names');

        $form8->text('name',Model_Abstract::FIRST_NAME)->rule('required')->rule('alphanumcyr')->setWrapperClass('float50');
        $form8->text('last_name',Model_Abstract::LAST_NAME)->rule('required')->rule('alphanumcyr')->setWrapperClass('float47');
        $form8->text('email',Model_Abstract::EMAIL)->rule('required')->rule('email')->setWrapperClass('float50');

        $form8->text('phon_num',Model_Abstract::PHONE_NUM)->rule('required')->setWrapperClass('float47');
        $form8->text('zip_code',Model_Abstract::ZIP_CODE)->rule('required')->rule('alphanum')->setWrapperClass('float50');
        $form8->text('address',Model_Abstract::ADDRESS)->rule('required')->setWrapperClass('float47');
        $form8->submit('submit','')->setWrapperClass('floatL');

        $form8->fieldset('submit');




        $this->template->content->form8 = $form8;

        if (Request::$method == 'POST') {

            if ($form8->validate()) {
                if(isset($_SESSION['form_error'])){
                    unset($_SESSION['form_error']);
                }

                $values = $form8->getValues();



                $this->services = new Model_Services($values,$form_8_name);
                $reqId = $this->services->addRequest();
                $this->services->sendRequestOnEmail($reqId);

                if($reqId){
                    echo '<script type="text/javascript">alert("Thank you choosing us!\\nOur manager will work up your request and contact you soon")</script>';
                }

            }
            elseif(!$form8->validate()) {
                if(!isset($_SESSION)){
                    session_start();
                }
                $_SESSION['form_error'] = true;
            }
        }


        //2 commercial form(9)

        $form_9_name = 'recurring_cleaning_comm';
        $form9 = new Form($form_9_name,'','');
        $form9->hidden('residence_type','Commercial');

        $form9->fieldset('main_services_info');

        $form9->radio('how_often',array('weekly'=>Model_Abstract::WEEKLY,'monthly'=>Model_Abstract::MONTHLY,'every_other_week'=>Model_Abstract::EVERY_OTHER_WEEK,'not_sure_yet'=>Model_Abstract::NOT_SURE_YET,),Model_Abstract::OFTEN)->rule('required');
        $form9->radio('how_many_levels',array('one_level'=>Model_Abstract::ONE_LEVEL,'two_levels'=>Model_Abstract::TWO_LEVELS,'three_levels'=>Model_Abstract::THREE_LEVELS,'four_levels'=>Model_Abstract::FOUR_LEVELS,'more_levels'=>Model_Abstract::MORE_LEVELS),Model_Abstract::LEVELS);
        $form9->text('business_type',Model_Abstract::BUSINESS_TYPE)->rule('required')->setWrapperClass('float50');
        $form9->text('how_many_rooms',Model_Abstract::ROOMS)->rule('required')->rule('integer')->setWrapperClass('float47');

        $form9->text('how_many_bathrooms',Model_Abstract::BATHROOMS)->rule('required')->rule('integer')->setWrapperClass('float50');
        $form9->text('square',Model_Abstract::SQUARE)->rule('float')->setWrapperClass('float47');

        $form9->fieldset('main_services_details');
        $form9->textarea('best_days',Model_Abstract::BESTDAYS)->rule('required');
        $form9->textarea('request_details',Model_Abstract::DETAILS)->rule('required');

        $form9->fieldset('main_services_names');

        $form9->text('name',Model_Abstract::FIRST_NAME)->rule('required')->rule('alphanumcyr')->setWrapperClass('float50');
        $form9->text('last_name',Model_Abstract::LAST_NAME)->rule('required')->rule('alphanumcyr')->setWrapperClass('float47');
        $form9->text('email',Model_Abstract::EMAIL)->rule('required')->rule('email')->setWrapperClass('float50');

        $form9->text('phon_num',Model_Abstract::PHONE_NUM)->rule('required')->setWrapperClass('float47');
        $form9->text('zip_code',Model_Abstract::ZIP_CODE)->rule('required')->rule('alphanum')->setWrapperClass('float50');
        $form9->text('address',Model_Abstract::ADDRESS)->rule('required')->setWrapperClass('float47');

        $form9->submit('submit','')->setWrapperClass('floatL');

        $this->template->content->form9 = $form9;

        if (Request::$method == 'POST') {

            if ($form9->validate()) {
                if(isset($_SESSION['form_error'])){
                    unset($_SESSION['form_error']);
                }

                $values = $form9->getValues();

                $this->services = new Model_Services($values,$form_9_name);
                $reqId = $this->services->addRequest();
                $this->services->sendRequestOnEmail($reqId);

                if($reqId){
                    echo '<script type="text/javascript">alert("Thank you choosing us!\\nOur manager will work up your request and contact you soon")</script>';
                }

            }
            elseif(!$form9->validate()) {
                if(!isset($_SESSION)){
                    session_start();
                }
                $_SESSION['form_error'] = true;
            }
        }

        //3 commercail form(10)

        $form_10_name = 'general_cleaning_comm';
        $form10 = new Form($form_10_name,'','');
        $form10->hidden('residence_type','Commercial');

        $form10->fieldset('main_services_info');

        $form10->radio('how_often',array('weekly'=>Model_Abstract::WEEKLY,'monthly'=>Model_Abstract::MONTHLY,'every_other_week'=>Model_Abstract::EVERY_OTHER_WEEK,'not_sure_yet'=>Model_Abstract::NOT_SURE_YET,),Model_Abstract::OFTEN)->rule('required');
        $form10->radio('how_many_levels',array('one_level'=>Model_Abstract::ONE_LEVEL,'two_levels'=>Model_Abstract::TWO_LEVELS,'three_levels'=>Model_Abstract::THREE_LEVELS,'four_levels'=>Model_Abstract::FOUR_LEVELS,'more_levels'=>Model_Abstract::MORE_LEVELS),Model_Abstract::LEVELS);
        $form10->text('business_type',Model_Abstract::BUSINESS_TYPE)->rule('required')->setWrapperClass('float50');
        $form10->text('how_many_rooms',Model_Abstract::ROOMS)->rule('required')->rule('integer')->setWrapperClass('float47');

        $form10->text('how_many_bathrooms',Model_Abstract::BATHROOMS)->rule('required')->rule('integer')->setWrapperClass('float50');
        $form10->text('square',Model_Abstract::SQUARE)->rule('float')->setWrapperClass('float47');

        $form10->fieldset('main_services_details');
        $form10->textarea('best_days',Model_Abstract::BESTDAYS)->rule('required');
        $form10->textarea('request_details',Model_Abstract::DETAILS)->rule('required');

        $form10->fieldset('main_services_names');

        $form10->text('name',Model_Abstract::FIRST_NAME)->rule('required')->rule('alphanumcyr')->setWrapperClass('float50');
        $form10->text('last_name',Model_Abstract::LAST_NAME)->rule('required')->rule('alphanumcyr')->setWrapperClass('float47');
        $form10->text('email',Model_Abstract::EMAIL)->rule('required')->rule('email')->setWrapperClass('float50');

        $form10->text('phon_num',Model_Abstract::PHONE_NUM)->rule('required')->setWrapperClass('float47');
        $form10->text('zip_code',Model_Abstract::ZIP_CODE)->rule('required')->rule('alphanum')->setWrapperClass('float50');
        $form10->text('address',Model_Abstract::ADDRESS)->rule('required')->setWrapperClass('float47');

        $form10->submit('submit','')->setWrapperClass('floatL');

        $this->template->content->form10 = $form10;

        if (Request::$method == 'POST') {

            if ($form10->validate()) {
                if(isset($_SESSION['form_error'])){
                    unset($_SESSION['form_error']);
                }

                $values = $form10->getValues();

                $this->services = new Model_Services($values,$form_10_name);
                $reqId = $this->services->addRequest();
                $this->services->sendRequestOnEmail($reqId);

                if($reqId){
                    echo '<script type="text/javascript">alert("Thank you choosing us!\\nOur manager will work up your request and contact you soon")</script>';
                }

            }
            elseif(!$form10->validate()) {
                if(!isset($_SESSION)){
                    session_start();
                }
                $_SESSION['form_error'] = true;
            }
        }

        //4 commercail form(11)

        $form_11_name = 'moving_cleaning_comm';
        $form11 = new Form($form_11_name,'','');

        $form11->hidden('residence_type','Commercial');

        $form11->fieldset('main_services_info');
        $form11->text('business_type',Model_Abstract::BUSINESS_TYPE)->rule('required')->setWrapperClass('float50');
        $form11->text('how_many_rooms',Model_Abstract::ROOMS)->rule('required')->rule('integer')->setWrapperClass('float47');
        $form11->text('how_many_bathrooms',Model_Abstract::BATHROOMS)->rule('required')->rule('integer')->setWrapperClass('float50');
        $form11->text('square',Model_Abstract::SQUARE)->rule('float')->setWrapperClass('float47');
        $form11->radio('how_many_levels',array('one_level'=>Model_Abstract::ONE_LEVEL,'two_levels'=>Model_Abstract::TWO_LEVELS,'three_levels'=>Model_Abstract::THREE_LEVELS,'four_levels'=>Model_Abstract::FOUR_LEVELS,'more_levels'=>Model_Abstract::MORE_LEVELS),Model_Abstract::LEVELS)->setWrapperClass('floatL100');

        $form11->fieldset('main_services_details');
        $form11->textarea('best_days',Model_Abstract::BESTDAYS)->rule('required');
        $form11->textarea('request_details',Model_Abstract::DETAILS)->rule('required');

        $form11->fieldset('main_services_names');
        $form11->text('name',Model_Abstract::FIRST_NAME)->rule('required')->rule('alphanumcyr')->setWrapperClass('float50');
        $form11->text('last_name',Model_Abstract::LAST_NAME)->rule('required')->rule('alphanumcyr')->setWrapperClass('float47');
        $form11->text('email',Model_Abstract::EMAIL)->rule('required')->rule('email')->setWrapperClass('float50');
        $form11->text('phon_num',Model_Abstract::PHONE_NUM)->rule('required')->setWrapperClass('float47');
        $form11->text('zip_code',Model_Abstract::ZIP_CODE)->rule('required')->rule('alphanum')->setWrapperClass('float50');
        $form11->text('address',Model_Abstract::ADDRESS)->rule('required')->setWrapperClass('float47');

        $form11->submit('submit','')->setWrapperClass('floatL');

        $this->template->content->form11 = $form11;

        if (Request::$method == 'POST') {

            if ($form11->validate()) {
                if(isset($_SESSION['form_error'])){
                    unset($_SESSION['form_error']);
                }

                $values = $form11->getValues();

                $this->services = new Model_Services($values,$form_11_name);
                $reqId = $this->services->addRequest();
                $this->services->sendRequestOnEmail($reqId);

                if($reqId){
                    echo '<script type="text/javascript">alert("Thank you choosing us!\\nOur manager will work up your request and contact you soon")</script>';
                }

            }
            elseif(!$form11->validate()) {
                if(!isset($_SESSION)){
                    session_start();
                }
                $_SESSION['form_error'] = true;
            }
        }

        //5 commercail form(12)

        $form_12_name = 'post_cleaning_comm';
        $form12 = new Form($form_12_name,'','');

        $form12->hidden('residence_type','Commercial');

        $form12->fieldset('main_services_info');
        $form12->text('business_type',Model_Abstract::BUSINESS_TYPE)->rule('required')->setWrapperClass('float50');
        $form12->text('how_many_rooms',Model_Abstract::ROOMS)->rule('required')->rule('integer')->setWrapperClass('float47');
        $form12->text('how_many_bathrooms',Model_Abstract::BATHROOMS)->rule('required')->rule('integer')->setWrapperClass('float50');
        $form12->text('square',Model_Abstract::SQUARE)->rule('float')->setWrapperClass('float47');
        $form12->radio('how_many_levels',array('one_level'=>Model_Abstract::ONE_LEVEL,'two_levels'=>Model_Abstract::TWO_LEVELS,'three_levels'=>Model_Abstract::THREE_LEVELS,'four_levels'=>Model_Abstract::FOUR_LEVELS,'more_levels'=>Model_Abstract::MORE_LEVELS),Model_Abstract::LEVELS);

        $form12->fieldset('main_services_details');
        $form12->textarea('best_days',Model_Abstract::BESTDAYS)->rule('required');
        $form12->textarea('request_details',Model_Abstract::DETAILS)->rule('required');

        $form12->fieldset('main_services_names');
        $form12->text('name',Model_Abstract::FIRST_NAME)->rule('required')->rule('alphanumcyr')->setWrapperClass('float50');
        $form12->text('last_name',Model_Abstract::LAST_NAME)->rule('required')->rule('alphanumcyr')->setWrapperClass('float47');
        $form12->text('email',Model_Abstract::EMAIL)->rule('required')->rule('email')->setWrapperClass('float50');
        $form12->text('phon_num',Model_Abstract::PHONE_NUM)->rule('required')->setWrapperClass('float47');
        $form12->text('zip_code',Model_Abstract::ZIP_CODE)->rule('required')->rule('alphanum')->setWrapperClass('float50');
        $form12->text('address',Model_Abstract::ADDRESS)->rule('required')->setWrapperClass('float47');

        $form12->submit('submit','')->setWrapperClass('floatL');

        $this->template->content->form12 = $form12;

        if (Request::$method == 'POST') {

            if ($form12->validate()) {
                if(isset($_SESSION['form_error'])){
                    unset($_SESSION['form_error']);
                }

                $values = $form12->getValues();

                $this->services = new Model_Services($values,$form_12_name);
                $reqId = $this->services->addRequest();
                $this->services->sendRequestOnEmail($reqId);

                if($reqId){
                    echo '<script type="text/javascript">alert("Thank you choosing us!\\nOur manager will work up your request and contact you soon")</script>';
                }

            }
            elseif(!$form12->validate()) {
                if(!isset($_SESSION)){
                    session_start();
                }
                $_SESSION['form_error'] = true;
            }
        }


        //6 commercail form(13)

        $form_13_name = 'after_party_cleaning_comm';
        $form13 = new Form($form_13_name,'','');

        $form13->hidden('residence_type','Commercial');

        $form13->fieldset('main_services_info');
        $form13->text('how_many_rooms',Model_Abstract::ROOMS)->rule('required')->rule('integer')->setWrapperClass('float50');
        $form13->text('how_many_bathrooms',Model_Abstract::BATHROOMS)->rule('required')->rule('integer')->setWrapperClass('float47');
        $form13->text('square',Model_Abstract::SQUARE)->rule('float')->setWrapperClass('floatL100');
        $form13->radio('how_many_levels',array('one_level'=>Model_Abstract::ONE_LEVEL,'two_levels'=>Model_Abstract::TWO_LEVELS,'three_levels'=>Model_Abstract::THREE_LEVELS,'four_levels'=>Model_Abstract::FOUR_LEVELS,'more_levels'=>Model_Abstract::MORE_LEVELS),Model_Abstract::LEVELS)->setWrapperClass('floatL100');

        $form13->fieldset('main_services_details');
        $form13->textarea('best_days',Model_Abstract::BESTDAYS)->rule('required');
        $form13->textarea('request_details',Model_Abstract::DETAILS)->rule('required');

        $form13->fieldset('main_services_names');
        $form13->text('name',Model_Abstract::FIRST_NAME)->rule('required')->rule('alphanumcyr')->setWrapperClass('float50');
        $form13->text('last_name',Model_Abstract::LAST_NAME)->rule('required')->rule('alphanumcyr')->setWrapperClass('float47');
        $form13->text('email',Model_Abstract::EMAIL)->rule('required')->rule('email')->setWrapperClass('float50');
        $form13->text('phon_num',Model_Abstract::PHONE_NUM)->rule('required')->setWrapperClass('float47');
        $form13->text('zip_code',Model_Abstract::ZIP_CODE)->rule('required')->rule('alphanum')->setWrapperClass('float50');
        $form13->text('address',Model_Abstract::ADDRESS)->rule('required')->setWrapperClass('float47');

        $form13->submit('submit','')->setWrapperClass('floatL');

        $this->template->content->form13 = $form13;

        if (Request::$method == 'POST') {

            if ($form13->validate()) {
                if(isset($_SESSION['form_error'])){
                    unset($_SESSION['form_error']);
                }

                $values = $form13->getValues();

                $this->services = new Model_Services($values,$form_13_name);
                $reqId = $this->services->addRequest();
                $this->services->sendRequestOnEmail($reqId);

                if($reqId){
                    echo '<script type="text/javascript">alert("Thank you choosing us!\\nOur manager will work up your request and contact you soon")</script>';
                }

            }
            elseif(!$form13->validate()) {
                if(!isset($_SESSION)){
                    session_start();
                }
                $_SESSION['form_error'] = true;
            }
        }

        //7 commercail form(14)

        $form_14_name = 'seasonal_cleaning_comm';
        $form14 = new Form($form_14_name,'','');

        $form14->hidden('residence_type','Commercial');

        $form14->fieldset('main_services_info');
        $form14->text('business_type',Model_Abstract::BUSINESS_TYPE)->rule('required')->setWrapperClass('floatL100');
        $form14->text('square',Model_Abstract::SQUARE)->rule('float')->setWrapperClass('floatL100');

        $form14->fieldset('main_services_details');
        $form14->textarea('best_days',Model_Abstract::BESTDAYS)->rule('required');
        $form14->textarea('request_details',Model_Abstract::DETAILS)->rule('required');

        $form14->fieldset('main_services_names');
        $form14->text('name',Model_Abstract::FIRST_NAME)->rule('required')->rule('alphanumcyr')->setWrapperClass('float50');
        $form14->text('last_name',Model_Abstract::LAST_NAME)->rule('required')->rule('alphanumcyr')->setWrapperClass('float47');
        $form14->text('email',Model_Abstract::EMAIL)->rule('required')->rule('email')->setWrapperClass('float50');
        $form14->text('phon_num',Model_Abstract::PHONE_NUM)->rule('required')->setWrapperClass('float47');
        $form14->text('zip_code',Model_Abstract::ZIP_CODE)->rule('required')->rule('alphanum')->setWrapperClass('float50');
        $form14->text('address',Model_Abstract::ADDRESS)->rule('required')->setWrapperClass('float47');

        $form14->submit('submit','')->setWrapperClass('floatL');

        $this->template->content->form14 = $form14;

        if (Request::$method == 'POST') {

            if ($form14->validate()) {
                if(isset($_SESSION['form_error'])){
                    unset($_SESSION['form_error']);
                }

                $values = $form14->getValues();

                $this->services = new Model_Services($values,$form_14_name);
                $reqId = $this->services->addRequest();
                $this->services->sendRequestOnEmail($reqId);

                if($reqId){
                    echo '<script type="text/javascript">alert("Thank you choosing us!\\nOur manager will work up your request and contact you soon")</script>';
                }

            }
            elseif(!$form14->validate()) {
                if(!isset($_SESSION)){
                    session_start();
                }
                $_SESSION['form_error'] = true;
            }
        }

        //end of forms

    }

}
